package br.com.view;

import br.com.dao.ConectaBanco;
import javax.swing.JOptionPane;

/**
 *
 * @author Cícero
 * @revisão aucélio
 */
public class Menu extends javax.swing.JFrame {

    ConectaBanco conexao = new ConectaBanco();
    br.com.view.Frm_setor frmSetor = new br.com.view.Frm_setor();
    Frm_CadFuncionario frmFuncionario = new Frm_CadFuncionario();
    Frm_CadFabricante frmFabricante = new Frm_CadFabricante();
    Frm_CadEpi frmEpi = new Frm_CadEpi();
    Frm_funcao frmFuncao = new Frm_funcao();
    Frm_EntradaEpi frmEntradaEpi = new Frm_EntradaEpi();
    Frm_EntregaEpi frmEntregaEpi = new Frm_EntregaEpi();
    /**
     * Creates new form Menu
     */
    public Menu() {

        initComponents();
        conexao.conexao();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jScrollPane1 = new javax.swing.JScrollPane();
        btnEntradaMenu = new javax.swing.JButton();
        btnSaidaMenu = new javax.swing.JButton();
        btnBuscarMenu = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenuCadastro = new javax.swing.JMenu();
        jMenuItemSetor = new javax.swing.JMenuItem();
        MenuItemFuncionario = new javax.swing.JMenuItem();
        MenuItemFuncao = new javax.swing.JMenuItem();
        MenuItemFaFo = new javax.swing.JMenuItem();
        MenuItemEpi = new javax.swing.JMenuItem();
        jMenuMovimentacao = new javax.swing.JMenu();
        MenuItemEntrada = new javax.swing.JMenuItem();
        jMenuItemEntrega = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuSair = new javax.swing.JMenu();

        jMenu1.setText("jMenu1");

        jMenuItem2.setText("jMenuItem2");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        btnEntradaMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/Entrada.png"))); // NOI18N
        btnEntradaMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEntradaMenuActionPerformed(evt);
            }
        });

        btnSaidaMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/Saida.png"))); // NOI18N
        btnSaidaMenu.setHideActionText(true);
        btnSaidaMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaidaMenuActionPerformed(evt);
            }
        });

        btnBuscarMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/Buscar.png"))); // NOI18N
        btnBuscarMenu.setBorder(null);
        btnBuscarMenu.setBorderPainted(false);
        btnBuscarMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarMenuActionPerformed(evt);
            }
        });

        jMenuCadastro.setText("Cadastro");

        jMenuItemSetor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (36).png"))); // NOI18N
        jMenuItemSetor.setText("Setor");
        jMenuItemSetor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemSetorActionPerformed(evt);
            }
        });
        jMenuCadastro.add(jMenuItemSetor);

        MenuItemFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (21).png"))); // NOI18N
        MenuItemFuncionario.setText("Funcionario");
        MenuItemFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemFuncionarioActionPerformed(evt);
            }
        });
        jMenuCadastro.add(MenuItemFuncionario);

        MenuItemFuncao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (34).png"))); // NOI18N
        MenuItemFuncao.setText("Função");
        MenuItemFuncao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemFuncaoActionPerformed(evt);
            }
        });
        jMenuCadastro.add(MenuItemFuncao);

        MenuItemFaFo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (41).png"))); // NOI18N
        MenuItemFaFo.setText("Fabricante/Fornecedor");
        MenuItemFaFo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemFaFoActionPerformed(evt);
            }
        });
        jMenuCadastro.add(MenuItemFaFo);

        MenuItemEpi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (38).png"))); // NOI18N
        MenuItemEpi.setText("EPI");
        MenuItemEpi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemEpiActionPerformed(evt);
            }
        });
        jMenuCadastro.add(MenuItemEpi);

        jMenuBar1.add(jMenuCadastro);

        jMenuMovimentacao.setText("Movimentação");

        MenuItemEntrada.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (12).png"))); // NOI18N
        MenuItemEntrada.setText("Entrada EPI");
        MenuItemEntrada.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MenuItemEntradaActionPerformed(evt);
            }
        });
        jMenuMovimentacao.add(MenuItemEntrada);

        jMenuItemEntrega.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (13).png"))); // NOI18N
        jMenuItemEntrega.setText("Entrega EPI");
        jMenuItemEntrega.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemEntregaActionPerformed(evt);
            }
        });
        jMenuMovimentacao.add(jMenuItemEntrega);

        jMenuBar1.add(jMenuMovimentacao);

        jMenu2.setText("Consulta");
        jMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu2ActionPerformed(evt);
            }
        });

        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icones sysepi/favicon (38).png"))); // NOI18N
        jMenuItem1.setText("EPI");
        jMenu2.add(jMenuItem1);

        jMenuBar1.add(jMenu2);

        jMenuSair.setText("Sair");
        jMenuSair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuSairMouseClicked(evt);
            }
        });
        jMenuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuSairActionPerformed(evt);
            }
        });
        jMenuBar1.add(jMenuSair);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(btnEntradaMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(btnSaidaMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(btnBuscarMenu)
                .addContainerGap(76, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btnBuscarMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnSaidaMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnEntradaMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setSize(new java.awt.Dimension(627, 476));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemSetorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSetorActionPerformed

        frmSetor.setVisible(true);
    }//GEN-LAST:event_jMenuItemSetorActionPerformed

    private void jMenuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuSairActionPerformed

        fechar();

    }//GEN-LAST:event_jMenuSairActionPerformed

    private void MenuItemEpiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemEpiActionPerformed

        frmEpi.setVisible(true);

    }//GEN-LAST:event_MenuItemEpiActionPerformed

    private void MenuItemFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemFuncionarioActionPerformed

        frmFuncionario.setVisible(true);

    }//GEN-LAST:event_MenuItemFuncionarioActionPerformed

    private void MenuItemFaFoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemFaFoActionPerformed

        frmFabricante.setVisible(true);

    }//GEN-LAST:event_MenuItemFaFoActionPerformed

    private void MenuItemFuncaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemFuncaoActionPerformed

        frmFuncao.setVisible(true);

    }//GEN-LAST:event_MenuItemFuncaoActionPerformed

    private void MenuItemEntradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MenuItemEntradaActionPerformed
        frmEntradaEpi.setVisible(true);
    }//GEN-LAST:event_MenuItemEntradaActionPerformed

    private void jMenuSairMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuSairMouseClicked
        System.exit(0);
    }//GEN-LAST:event_jMenuSairMouseClicked

    private void btnBuscarMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarMenuActionPerformed

        btnBuscarMenu.setToolTipText("Buscar de EPI");
        
    }//GEN-LAST:event_btnBuscarMenuActionPerformed

    private void btnEntradaMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEntradaMenuActionPerformed
        btnEntradaMenu.setToolTipText("Entrada de EPI");
        frmEntradaEpi.setVisible(true);
        
    }//GEN-LAST:event_btnEntradaMenuActionPerformed

    private void jMenuItemEntregaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemEntregaActionPerformed
         frmEntregaEpi.setVisible(true);
    }//GEN-LAST:event_jMenuItemEntregaActionPerformed

    private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenu2ActionPerformed

    private void btnSaidaMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaidaMenuActionPerformed
        
        btnSaidaMenu.setToolTipText("Entrega de EPI");
        
    }//GEN-LAST:event_btnSaidaMenuActionPerformed
    private void fechar() {
        conexao.desconecta();
        JOptionPane.showMessageDialog(null, "Fechando Sistema", "Ateção", EXIT_ON_CLOSE);
        System.exit(0);
    }
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new Menu().setVisible(true);
//            }
//        });
//    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem MenuItemEntrada;
    private javax.swing.JMenuItem MenuItemEpi;
    private javax.swing.JMenuItem MenuItemFaFo;
    private javax.swing.JMenuItem MenuItemFuncao;
    private javax.swing.JMenuItem MenuItemFuncionario;
    private javax.swing.JButton btnBuscarMenu;
    private javax.swing.JButton btnEntradaMenu;
    private javax.swing.JButton btnSaidaMenu;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenu jMenuCadastro;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItemEntrega;
    private javax.swing.JMenuItem jMenuItemSetor;
    private javax.swing.JMenu jMenuMovimentacao;
    private javax.swing.JMenu jMenuSair;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
}
